package com.forensix.interface_test.utils;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

public class ResponseJsonNodeUtil {


    /**
     *
     * @param body : 请求体
     * @return json 节点中的key 或者 value
     * <p>
     *     响应为：json格式
     *     将返回过来的json进行读取
     *     主要用作于进行断言
     * </p>
     */
    public static JsonNode ResponseJsonNode(String body)  {

        ObjectMapper mapper = new ObjectMapper();
        JsonNode jsonNode = null;
        try {
            jsonNode = mapper.readTree(body);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
        return jsonNode;
    }




}
